#!/bin/sh

set -ex

patch_conf() {
    touch $VENUS_INITIALIZED_MARK
}

prepare() {
  if [ $? = 0 ]; then
    patch_conf
  fi
}

$VENUS_DIR/liveness_probe.sh $VENUS_CMS_HOST $VENUS_CMS_ADMIN_PORT  

if [ ! -f "$VENUS_INITIALIZED_MARK" ]; then

  prepare

  echo
  echo 'venus init process complete; ready for start up.'
  echo
else
  echo
  echo 'Skipping initialization'
  echo
fi

/bin/sh -c "$@"